docs(api): hide models sidebar in Scalar reference#3459
docs(api): hide models sidebar in Scalar reference#3459PierreBrisorgueil merged 1 commit intomasterfrom
Conversation
Pass `hideModels: true` to the Scalar apiReference middleware so the public `/api/docs` no longer exposes the internal Models tree (Mongoose-derived shapes, error envelopes, intermediate DTOs). Schemas are still documented inline on each endpoint — the Models section just leaks implementation detail without helping API consumers. Stack-side default — every downstream project benefits without extra config. Closes #3458
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA single configuration option was added to the Scalar API reference UI to hide the Models section by default, preventing exposure of internal schema details in the public-facing API documentation at Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the Scalar API reference UI configuration to avoid exposing internal schema/model details in the public docs, while keeping endpoint-level request/response schemas visible inline.
Changes:
- Pass
hideModels: trueto the ScalarapiReferencemiddleware mounted at/api/docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3459 +/- ##
=======================================
Coverage 85.81% 85.81%
=======================================
Files 115 115
Lines 2911 2911
Branches 805 805
=======================================
Hits 2498 2498
Misses 327 327
Partials 86 86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
hideModels: trueto the ScalarapiReferencemiddleware mounted at/api/docsinlib/services/express.js.Verification
hideModelsoption confirmed against the installed version of@scalar/express-api-reference(0.9.7). The config type isHtmlRenderingConfigurationre-exported from@scalar/core, andnode_modules/@scalar/types/dist/api-reference/api-reference-configuration.d.tsdeclareshideModels: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>— option name and typing both valid.hiddenClientstrimming,customCss, layout tuning.Test plan
npm run lint— greennpm test— 499/499 unit tests passingCloses #3458
Summary by CodeRabbit
/api/docs.